package com.tomorrow.ktv;

import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class Start extends Activity implements View.OnClickListener {

	private Button login;
	private EditText phoneNum;
	private EditText password;
	private String tag = "Start";

	TextWatcher textWacher = new TextWatcher() {
		private CharSequence temp;

		@Override
		public void afterTextChanged(Editable s) {
			// TODO Auto-generated method stub
			if (temp.length() >= 3) {
				login.setBackgroundResource(R.drawable.button_registration_bg_n);
				login.setEnabled(true);
			}
				
				phoneNum.setText(temp);
		}

		@Override
		public void beforeTextChanged(CharSequence s, int start, int count, int after) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void onTextChanged(CharSequence s, int start, int before, int count) {
			// TODO Auto-generated method stub
			temp = s;
		}

	};

	public void onCreate(Bundle paramBundle) {
		// Log.i(this.tag, "Initial starting.");
		super.onCreate(paramBundle);
		this.setContentView(R.layout.ktv_user_registration);
		this.login = (Button) findViewById(R.id.complete_registration_button);
		this.login.setOnClickListener(this);
//		this.login.setEnabled(true);
		this.password = (EditText) findViewById(R.id.verification_code_field);
		this.phoneNum=(EditText) findViewById(R.id.phone_number_field);
		this.password.addTextChangedListener(textWacher);

	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub

		if (v == login) {
			Log.i(tag, "login ....");
		}
	}

}
